package dao;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;


import modelos.Cliente;
import interfaces.IDaoCliente;

public class DaoCliente extends DaoGenerico<Cliente> implements IDaoCliente  {
	public DaoCliente() {
	}
	
	public Cliente getPorId(int id) 
	{
		Criteria criteria = this.getCriteria();
		criteria.add(Restrictions.eq("id", id));
		Cliente a = (Cliente) criteria.uniqueResult();
		return a;
	}
	
	public Cliente getPorcpf(String cpf) 
	{
		Criteria criteria = this.getCriteria();
		criteria.add(Restrictions.eq("cpf", cpf));
		Cliente a = (Cliente) criteria.uniqueResult();
		return a;
	}
}
